#!/usr/bin/env python
'''
Created on 12.03.2014

@author: Jan-Patrick
'''
import screen


class Objects(object):
    '''
    Defines player and enemies properties and methods.
    '''
    def __init__(self,posX,posY,leben,munition,speed):
        self.PosX = posX
        self.PosY = posY
        self.Leben = leben
        self.Munition = munition
        self.Speed = speed
        self.Xsize = screen.Screen.xsize
        self.Ysize = screen.Screen.ysize
    
    posX = 0
    posY = 0
    leben = 0
    munition = 0
    speed = 0
    direction = ""
    
    def move(self, x):
        self.posX += x    
        screen.Screen.x = self.posX
        if x<0:
            direction = "leftwards"
            x *= -1
        elif x>0:
            direction = "rightwards"
        print "Moved the " + self.__class__.__name__ + " "+ str(x) + " Steps " + direction + "."
        print self.__class__.__name__ + " is now on Position " + str(self.posX) + " " + str(self.posY) + "."
        
'''    
    Getter and Setter aren't required in Python.
    
    def setX(self, posX):
        self.posX = posX
        pass
        
    def getX(self):
        return self.posX
        pass
        
    def setY(self, posY):
        self.posY = posY
        pass
        
    def getY(self):
        return self.posY
        pass
    
    def setLeben(self, leben):
        self.leben = leben
        pass
    
    def getLeben(self):
        return self.leben
        pass'''
    
    
class Player(Objects):    
    def __init__(self,posX,posY,leben,munition,speed):
        Objects.__init__(self,posX,posY,leben,munition,speed)        
      
    punkte = 5    


    
class Enemy(Objects):
    def __init__(self,posX,posY,leben,munition,speed):
        Objects.__init__(self,posX,posY,leben,munition,speed)

    PosX = 4
    
    def addEnemies(self,anzahl,leben,munition,speed):
        print "--------------------"
        print "Creating " + str(anzahl) + " Enemies"
        print "--------------------"
        print ""
        Enemies = [Enemy(10,10,100,10*i,i,i) for i in range(anzahl)]  
        for i in range(anzahl):
            Enemies[i].no = i
            Enemies[i].speed = speed
            Enemies[i].munition = munition
            Enemies[i].leben = leben
            if i == anzahl-1:
                print "All Enemies been created!"
                print ""
        
        print "--------------------"
        print "Listing the Enemies"
        print "--------------------"
        print ""    
        for i in range(anzahl):
            'showEnemy(self,i)'
            print "Informations about Enemy No. " + str(i)
            print "Number: " + str(Enemies[i].no)
            print "Health: " + str(Enemies[i].leben)
            print "Ammunantion: " + str(Enemies[i].munition)
            print "Speed: " + str(Enemies[i].speed)        
            print "Position: " + str(Enemies[i].posX) + "|" + str(Enemies[i].posY)
            print ""
            if i == anzahl-1:
                print "All Enemies been listed!"
                print ""    
                
            
    
class Bullet(Objects):
    import screen
    
    def __init__(self,posX,posY,leben,munition,speed,bullet_obj):
        Objects.__init__(self, posX, posY, leben,munition,0) 
        self.bullet_obj = None
    
    def shotEvent(self):
        bullet1.posX = player1.posX+25
        bullet1.posY = player1.posY +25
        screen.Screen.shotEvent(self)




player1 = Player(5,500,400,100,0)
bullet1 = Bullet(120,20,20,0,0,None)

print player1.punkte
print player1.posX
player1.move(5)
player1.move(-3)
